//
//  JLCreateJobMegViewController.m
//  JLStyleApp
//
//  Created by LvJianfeng on 15/8/22.
//  Copyright (c) 2015年 JLStyle. All rights reserved.
//

#import "JLCreateJobMegViewController.h"

@interface JLCreateJobMegViewController ()
@property (weak, nonatomic) IBOutlet UITextField *moneyTextField;
@property (weak, nonatomic) IBOutlet UILabel *hangyeLabel;
@property (weak, nonatomic) IBOutlet UITextField *companyNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *currentJobTextField;
@property (weak, nonatomic) IBOutlet UILabel *yearsLabel;
@property (weak, nonatomic) IBOutlet UITextField *needJobTextField;
@property (weak, nonatomic) IBOutlet UITextField *schoolTextFiled;

@end

@implementation JLCreateJobMegViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"职业信息";
    self.view.backgroundColor = [UIColor customControllerBackgroundColor];
    EmtryCellHidden(self.tableView);
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 20)];
    
    [self setupRightBarItem];
    
    [self storyboardUIInit];
}

- (void)doneAction{
    
}

#pragma mark UITabelViewDelegate

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 1:
        {
            dispatch_async(dispatch_get_main_queue(), ^{
                JLJobTableViewController *jobTableViewController = [[JLJobTableViewController alloc] init];
                UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:jobTableViewController];
                [navigationController.navigationBar setCustomBackgroundColor:GlobalColor];
                navigationController.navigationBar.tintColor = [UIColor whiteColor];
                [navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,JLBlodFont(17),NSFontAttributeName,nil]];
                jobTableViewController.delegate = self;
                [self presentViewController:navigationController animated:YES completion:nil];
            });
        }
            break;
        case 4:
        {
            dispatch_async(dispatch_get_main_queue(), ^{
                JLYearTableViewController *yearTableViewController = [[JLYearTableViewController alloc] init];
                UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:yearTableViewController];
                [navigationController.navigationBar setCustomBackgroundColor:GlobalColor];
                navigationController.navigationBar.tintColor = [UIColor whiteColor];
                [navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,JLBlodFont(17),NSFontAttributeName,nil]];
                yearTableViewController.delegate = self;
                [self presentViewController:navigationController animated:YES completion:nil];
            });
        }
            break;
        default:
            break;
    }
}

#pragma mark JobPassValueDelegate
- (void)jobPassValue:(NSString *)text{
    self.hangyeLabel.text = text;
    if (![self.hangyeLabel.text isEqualToString:@"点击选择"]) {
        self.hangyeLabel.textColor = [UIColor darkGrayColor];
    }else{
        self.hangyeLabel.textColor = [UIColor lightGrayColor];
    }
}

#pragma mark YearPassValueDelegate
- (void)yearPassValue:(NSString *)text{
    self.yearsLabel.text = text;
    if (![self.yearsLabel.text isEqualToString:@"点击选择"]) {
        self.yearsLabel.textColor = [UIColor darkGrayColor];
    }else{
        self.yearsLabel.textColor = [UIColor lightGrayColor];
    }
}

- (void)storyboardUIInit{
    self.moneyTextField.keyboardType = UIKeyboardTypeNumberPad;
    
    self.moneyTextField.placeholderColor  = [UIColor lightGrayColor];
    self.companyNameTextField.placeholderColor = [UIColor lightGrayColor];
    self.currentJobTextField.placeholderColor = [UIColor lightGrayColor];
    self.needJobTextField.placeholderColor = [UIColor lightGrayColor];
    self.schoolTextFiled.placeholderColor = [UIColor lightGrayColor];
}

- (void)setupRightBarItem{
    UIButton *doneButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 20)];
    doneButton.titleLabel.font = JLFont(15);
    [doneButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [doneButton setTitleColor:[UIColor customLightPlaceColor] forState:UIControlStateHighlighted];
    [doneButton setTitle:@"完成" forState:UIControlStateNormal];
    [doneButton addTarget:self action:@selector(doneAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithCustomView:doneButton];
    self.navigationItem.rightBarButtonItem = rightBarItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
